\hypertarget{a00104}{}\section{E\+:/knet-\/git/knet/knet/timer\+\_\+api.h 文件参考}
\label{a00104}\index{E\+:/knet-\/git/knet/knet/timer\+\_\+api.\+h@{E\+:/knet-\/git/knet/knet/timer\+\_\+api.\+h}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\\*
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ \hyperlink{a00122_gaef96e7c368db456236a2121e3d75c49c_gaef96e7c368db456236a2121e3d75c49c}{ktimer\+\_\+loop\+\_\+create} (time\+\_\+t freq, int slot)
\begin{DoxyCompactList}\small\item\em 创建定时器循环 \end{DoxyCompactList}\item 
void \hyperlink{a00122_gad3dafe93f5b45424bd5983ef0c163687_gad3dafe93f5b45424bd5983ef0c163687}{ktimer\+\_\+loop\+\_\+destroy} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 销毁定时器循环 \end{DoxyCompactList}\item 
int \hyperlink{a00122_gaf195cf4006bced494e99242c36ad36c0_gaf195cf4006bced494e99242c36ad36c0}{ktimer\+\_\+loop\+\_\+run\+\_\+once} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 检查定时器超时，如果超时调用定时器回调 \end{DoxyCompactList}\item 
void \hyperlink{a00122_ga5e31b2fc26af005e97b09804c5a98099_ga5e31b2fc26af005e97b09804c5a98099}{ktimer\+\_\+loop\+\_\+run} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 循环检查定时器超时，调用ktimer\+\_\+loop\+\_\+exit()退出 \end{DoxyCompactList}\item 
void \hyperlink{a00122_ga9d51f5fa5d9609d783eb4b0e05101079_ga9d51f5fa5d9609d783eb4b0e05101079}{ktimer\+\_\+loop\+\_\+exit} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 退出ktimer\+\_\+loop\+\_\+run() \end{DoxyCompactList}\item 
\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$ \hyperlink{a00122_ga37901569361ae2a726a1973d7da2d6e5_ga37901569361ae2a726a1973d7da2d6e5}{ktimer\+\_\+create} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 创建一个定时器 \end{DoxyCompactList}\item 
int \hyperlink{a00122_ga1465f5ddec41fa81c429d1647dc5e7a9_ga1465f5ddec41fa81c429d1647dc5e7a9}{ktimer\+\_\+stop} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer)
\begin{DoxyCompactList}\small\item\em 停止并销毁定时器 \end{DoxyCompactList}\item 
\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ \hyperlink{a00122_gad2c8d1024db56a0bef97ea47fb07a920_gad2c8d1024db56a0bef97ea47fb07a920}{ktimer\+\_\+get\+\_\+loop} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer)
\begin{DoxyCompactList}\small\item\em 取得ktimer\+\_\+loop\+\_\+t实例 \end{DoxyCompactList}\item 
int \hyperlink{a00122_ga8c5900fb62a63dc71cc9f38ac6427ad1_ga8c5900fb62a63dc71cc9f38ac6427ad1}{ktimer\+\_\+start} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer, \hyperlink{a00056_a2333fd0f2c3a85faf586300ca40deed4_a2333fd0f2c3a85faf586300ca40deed4}{ktimer\+\_\+cb\+\_\+t} cb, void $\ast$data, time\+\_\+t ms)
\begin{DoxyCompactList}\small\item\em 启动一个无限次数的定时器 \end{DoxyCompactList}\item 
int \hyperlink{a00122_ga9c37409260a72e3218ae4fcaf44d79bc_ga9c37409260a72e3218ae4fcaf44d79bc}{ktimer\+\_\+start\+\_\+once} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer, \hyperlink{a00056_a2333fd0f2c3a85faf586300ca40deed4_a2333fd0f2c3a85faf586300ca40deed4}{ktimer\+\_\+cb\+\_\+t} cb, void $\ast$data, time\+\_\+t ms)
\begin{DoxyCompactList}\small\item\em 启动一个只超时一次的定时器，超时后将自动销毁 \end{DoxyCompactList}\item 
int \hyperlink{a00122_ga285936846760d9f325e588d2e2105fe5_ga285936846760d9f325e588d2e2105fe5}{ktimer\+\_\+start\+\_\+times} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer, \hyperlink{a00056_a2333fd0f2c3a85faf586300ca40deed4_a2333fd0f2c3a85faf586300ca40deed4}{ktimer\+\_\+cb\+\_\+t} cb, void $\ast$data, time\+\_\+t ms, int times)
\begin{DoxyCompactList}\small\item\em 启动一个有限次数的定时器，达到times次数后将自动销毁 \end{DoxyCompactList}\item 
int \hyperlink{a00122_ga9387b99ff760183fe8b61c8c46d6efc8_ga9387b99ff760183fe8b61c8c46d6efc8}{ktimer\+\_\+check\+\_\+dead} (\hyperlink{a00056_a846172ea4e8a86449eca41a3d8e074b7_a846172ea4e8a86449eca41a3d8e074b7}{ktimer\+\_\+t} $\ast$timer)
\begin{DoxyCompactList}\small\item\em 检查定时器是否在回调函数返回即将被销毁 \end{DoxyCompactList}\item 
time\+\_\+t \hyperlink{a00122_ga71282c2dc8bac0935617b1271f4066e6_ga71282c2dc8bac0935617b1271f4066e6}{ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval} (\hyperlink{a00056_a024af2aa29615e7a811ea6c45438157d_a024af2aa29615e7a811ea6c45438157d}{ktimer\+\_\+loop\+\_\+t} $\ast$ktimer\+\_\+loop)
\begin{DoxyCompactList}\small\item\em 取得滴答间隔 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{函数说明}
\hypertarget{a00122_ga9387b99ff760183fe8b61c8c46d6efc8_ga9387b99ff760183fe8b61c8c46d6efc8}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+check\+\_\+dead@{ktimer\+\_\+check\+\_\+dead}}
\index{ktimer\+\_\+check\+\_\+dead@{ktimer\+\_\+check\+\_\+dead}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+check\+\_\+dead}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+check\+\_\+dead (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer}
\end{DoxyParamCaption}
)}\label{a00122_ga9387b99ff760183fe8b61c8c46d6efc8_ga9387b99ff760183fe8b61c8c46d6efc8}


检查定时器是否在回调函数返回即将被销毁 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 不是 \\
\hline
{\em 非零} & 是 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00122_ga37901569361ae2a726a1973d7da2d6e5_ga37901569361ae2a726a1973d7da2d6e5}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+create@{ktimer\+\_\+create}}
\index{ktimer\+\_\+create@{ktimer\+\_\+create}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ktimer\+\_\+t}$\ast$ ktimer\+\_\+create (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_ga37901569361ae2a726a1973d7da2d6e5_ga37901569361ae2a726a1973d7da2d6e5}


创建一个定时器 


\begin{DoxyParams}{参数}
{\em ktimer\+\_\+loop} & ktimer\+\_\+loop\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
ktimer\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00122_gad2c8d1024db56a0bef97ea47fb07a920_gad2c8d1024db56a0bef97ea47fb07a920}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+get\+\_\+loop@{ktimer\+\_\+get\+\_\+loop}}
\index{ktimer\+\_\+get\+\_\+loop@{ktimer\+\_\+get\+\_\+loop}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+get\+\_\+loop}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ktimer\+\_\+loop\+\_\+t}$\ast$ ktimer\+\_\+get\+\_\+loop (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer}
\end{DoxyParamCaption}
)}\label{a00122_gad2c8d1024db56a0bef97ea47fb07a920_gad2c8d1024db56a0bef97ea47fb07a920}


取得ktimer\+\_\+loop\+\_\+t实例 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
ktimer\+\_\+loop\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00122_gaef96e7c368db456236a2121e3d75c49c_gaef96e7c368db456236a2121e3d75c49c}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+create@{ktimer\+\_\+loop\+\_\+create}}
\index{ktimer\+\_\+loop\+\_\+create@{ktimer\+\_\+loop\+\_\+create}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ktimer\+\_\+loop\+\_\+t}$\ast$ ktimer\+\_\+loop\+\_\+create (
\begin{DoxyParamCaption}
\item[{time\+\_\+t}]{freq, }
\item[{int}]{slot}
\end{DoxyParamCaption}
)}\label{a00122_gaef96e7c368db456236a2121e3d75c49c_gaef96e7c368db456236a2121e3d75c49c}


创建定时器循环 


\begin{DoxyParams}{参数}
{\em freq} & 最小分辨率（毫秒） \\
\hline
{\em slot} & 时间轮槽位数量 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
ktimer\+\_\+loop\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00122_gad3dafe93f5b45424bd5983ef0c163687_gad3dafe93f5b45424bd5983ef0c163687}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+destroy@{ktimer\+\_\+loop\+\_\+destroy}}
\index{ktimer\+\_\+loop\+\_\+destroy@{ktimer\+\_\+loop\+\_\+destroy}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}void ktimer\+\_\+loop\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_gad3dafe93f5b45424bd5983ef0c163687_gad3dafe93f5b45424bd5983ef0c163687}


销毁定时器循环 

\begin{DoxyReturn}{返回}
ktimer\+\_\+loop\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00122_ga9d51f5fa5d9609d783eb4b0e05101079_ga9d51f5fa5d9609d783eb4b0e05101079}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+exit@{ktimer\+\_\+loop\+\_\+exit}}
\index{ktimer\+\_\+loop\+\_\+exit@{ktimer\+\_\+loop\+\_\+exit}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+exit}]{\setlength{\rightskip}{0pt plus 5cm}void ktimer\+\_\+loop\+\_\+exit (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_ga9d51f5fa5d9609d783eb4b0e05101079_ga9d51f5fa5d9609d783eb4b0e05101079}


退出ktimer\+\_\+loop\+\_\+run() 


\begin{DoxyParams}{参数}
{\em ktimer\+\_\+loop} & ktimer\+\_\+loop\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00122_ga71282c2dc8bac0935617b1271f4066e6_ga71282c2dc8bac0935617b1271f4066e6}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval@{ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval}}
\index{ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval@{ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval}]{\setlength{\rightskip}{0pt plus 5cm}time\+\_\+t ktimer\+\_\+loop\+\_\+get\+\_\+tick\+\_\+intval (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_ga71282c2dc8bac0935617b1271f4066e6_ga71282c2dc8bac0935617b1271f4066e6}


取得滴答间隔 


\begin{DoxyParams}{参数}
{\em ktimer\+\_\+loop} & ktimer\+\_\+loop\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
滴答间隔 
\end{DoxyReturn}
\hypertarget{a00122_ga5e31b2fc26af005e97b09804c5a98099_ga5e31b2fc26af005e97b09804c5a98099}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+run@{ktimer\+\_\+loop\+\_\+run}}
\index{ktimer\+\_\+loop\+\_\+run@{ktimer\+\_\+loop\+\_\+run}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+run}]{\setlength{\rightskip}{0pt plus 5cm}void ktimer\+\_\+loop\+\_\+run (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_ga5e31b2fc26af005e97b09804c5a98099_ga5e31b2fc26af005e97b09804c5a98099}


循环检查定时器超时，调用ktimer\+\_\+loop\+\_\+exit()退出 


\begin{DoxyParams}{参数}
{\em ktimer\+\_\+loop} & ktimer\+\_\+loop\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00122_gaf195cf4006bced494e99242c36ad36c0_gaf195cf4006bced494e99242c36ad36c0}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+loop\+\_\+run\+\_\+once@{ktimer\+\_\+loop\+\_\+run\+\_\+once}}
\index{ktimer\+\_\+loop\+\_\+run\+\_\+once@{ktimer\+\_\+loop\+\_\+run\+\_\+once}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+loop\+\_\+run\+\_\+once}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+loop\+\_\+run\+\_\+once (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+loop\+\_\+t} $\ast$}]{ktimer\+\_\+loop}
\end{DoxyParamCaption}
)}\label{a00122_gaf195cf4006bced494e99242c36ad36c0_gaf195cf4006bced494e99242c36ad36c0}


检查定时器超时，如果超时调用定时器回调 


\begin{DoxyParams}{参数}
{\em ktimer\+\_\+loop} & ktimer\+\_\+loop\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
定时器超时的数量 
\end{DoxyReturn}
\hypertarget{a00122_ga8c5900fb62a63dc71cc9f38ac6427ad1_ga8c5900fb62a63dc71cc9f38ac6427ad1}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+start@{ktimer\+\_\+start}}
\index{ktimer\+\_\+start@{ktimer\+\_\+start}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+start}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+start (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer, }
\item[{{\bf ktimer\+\_\+cb\+\_\+t}}]{cb, }
\item[{void $\ast$}]{data, }
\item[{time\+\_\+t}]{ms}
\end{DoxyParamCaption}
)}\label{a00122_ga8c5900fb62a63dc71cc9f38ac6427ad1_ga8c5900fb62a63dc71cc9f38ac6427ad1}


启动一个无限次数的定时器 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
{\em cb} & 超时回调函数 \\
\hline
{\em data} & 回调函数参数 \\
\hline
{\em ms} & 定时器超时间隔 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00122_ga9c37409260a72e3218ae4fcaf44d79bc_ga9c37409260a72e3218ae4fcaf44d79bc}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+start\+\_\+once@{ktimer\+\_\+start\+\_\+once}}
\index{ktimer\+\_\+start\+\_\+once@{ktimer\+\_\+start\+\_\+once}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+start\+\_\+once}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+start\+\_\+once (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer, }
\item[{{\bf ktimer\+\_\+cb\+\_\+t}}]{cb, }
\item[{void $\ast$}]{data, }
\item[{time\+\_\+t}]{ms}
\end{DoxyParamCaption}
)}\label{a00122_ga9c37409260a72e3218ae4fcaf44d79bc_ga9c37409260a72e3218ae4fcaf44d79bc}


启动一个只超时一次的定时器，超时后将自动销毁 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
{\em cb} & 超时回调函数 \\
\hline
{\em data} & 回调函数参数 \\
\hline
{\em ms} & 定时器超时间隔 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00122_ga285936846760d9f325e588d2e2105fe5_ga285936846760d9f325e588d2e2105fe5}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+start\+\_\+times@{ktimer\+\_\+start\+\_\+times}}
\index{ktimer\+\_\+start\+\_\+times@{ktimer\+\_\+start\+\_\+times}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+start\+\_\+times}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+start\+\_\+times (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer, }
\item[{{\bf ktimer\+\_\+cb\+\_\+t}}]{cb, }
\item[{void $\ast$}]{data, }
\item[{time\+\_\+t}]{ms, }
\item[{int}]{times}
\end{DoxyParamCaption}
)}\label{a00122_ga285936846760d9f325e588d2e2105fe5_ga285936846760d9f325e588d2e2105fe5}


启动一个有限次数的定时器，达到times次数后将自动销毁 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
{\em cb} & 超时回调函数 \\
\hline
{\em data} & 回调函数参数 \\
\hline
{\em ms} & 定时器超时间隔 \\
\hline
{\em times} & 次数 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00122_ga1465f5ddec41fa81c429d1647dc5e7a9_ga1465f5ddec41fa81c429d1647dc5e7a9}{}\index{timer\+\_\+api.\+h@{timer\+\_\+api.\+h}!ktimer\+\_\+stop@{ktimer\+\_\+stop}}
\index{ktimer\+\_\+stop@{ktimer\+\_\+stop}!timer\+\_\+api.\+h@{timer\+\_\+api.\+h}}
\subsubsection[{ktimer\+\_\+stop}]{\setlength{\rightskip}{0pt plus 5cm}int ktimer\+\_\+stop (
\begin{DoxyParamCaption}
\item[{{\bf ktimer\+\_\+t} $\ast$}]{timer}
\end{DoxyParamCaption}
)}\label{a00122_ga1465f5ddec41fa81c429d1647dc5e7a9_ga1465f5ddec41fa81c429d1647dc5e7a9}


停止并销毁定时器 


\begin{DoxyParams}{参数}
{\em timer} & ktimer\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
